package comptadub

class Presence extends LigneCompte {

    Integer nbPersonne      = 1
    Integer nbEnfant		= 0
    Integer nbGratuit		= 0
    Integer nbJour          = 1
    Date    dateArrivee     = new Date()
    Date    dateDepart      = new Date().next()

    static constraints = {
        nbPersonne(min:1)
        nbEnfant(min:0)
        nbGratuit(min:0)
        nbJour(min:1)
        dateArrivee(validator: {value, obj ->
					if(value > obj.properties["dateDepart"]) return ["default.date.coherence"]
                    })
        dateDepart(validator: {value, obj ->
					if(value < obj.properties["dateArrivee"]) return ["default.date.coherence"]
                    })
    }

    def String toString() {
        return "Présence"
    }
}
